﻿using LNet;
using OestsCommon.Model;
using OestsDataBase;
using OestsServer.Net;
using System.Collections.Generic;

namespace OestsServer.Handlers.OESPHandlers
{
    public class GetTrainErrorRateStatHandler : HandlerBase<OESPClientChannel>
    {
        public override PacketKey PKey => PacketKey.GetTrainErrorRateStat;

        public override void Execute(OESPClientChannel client, Request packet)
        {
            base.Execute(client, packet);

            Int2 v = LitJson.JsonMapper.ToObject<Int2>(packet.DataStr);

            List<TrainErrorStat> lst = TrainDAL.GetErrorRateStat(v.Int0, v.Int1);
            ResponsePacket.ReturnCode = ReturnCode.Success;
            ResponsePacket.DataObject = lst;
            client.Send(ResponsePacket);
        }
    }

}